
import financeApi from '@/api/declaration/erp/financeApi'
import httpRequest from '@/config/axios/httpRequest'
import { AccountModel } from '@/models/erp/AccountModel'



// ERP 结算账户 API
export const AccountApi = {
  // 查询结算账户分页
  getAccountPage: async (params: any) => {
    return await httpRequest.get<AccountModel[]>(financeApi.GetAccountPage, { params })
  },

  // 查询结算账户精简列表
  getAccountSimpleList: async () => {
    return await httpRequest.get(financeApi.GetAccountSimpleList)
  },

  // 查询结算账户详情
  getAccount: async (id: number) => {
    return await httpRequest.get<AccountModel>(financeApi.GetAccount, { params: { id } })
  },

  // 新增结算账户
  createAccount: async (data: AccountModel) => {
    return await httpRequest.post(financeApi.CreateAccount, data)
  },

  // 修改结算账户
  updateAccount: async (data: AccountModel) => {
    return await httpRequest.put(financeApi.UpdateAccount, data)
  },

  // 修改结算账户默认状态
  updateAccountDefaultStatus: async (id: number, defaultStatus: boolean) => {
    return await httpRequest.put(financeApi.UpdateAccountDefaultStatus, { id, defaultStatus })
  },

  // 删除结算账户
  deleteAccount: async (id: number) => {
    return await httpRequest.delete(financeApi.DeleteAccount, { params: { id } })
  },

  // 导出结算账户 Excel
  exportAccount: async (params: any) => {
    return await httpRequest.download(financeApi.ExportAccount, params)
  }
}
